package cn.yunyichina.provider.message.service.impl;

import cn.yunyichina.provider.framework.common.PKGenerator;
import cn.yunyichina.provider.message.dao.MsgCenterDao;
import cn.yunyichina.provider.message.entity.MsgCenter;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

/**
 * 消息中心
 * Created by Administrator on 2016/9/13.
 */
@Service
public class MsgCenterServiceImpl {
    @Autowired
    private MsgCenterDao msgCenterDao;

    public void add(MsgCenter msgCenter) {
        Assert.notNull(msgCenter);
        if (StringUtils.isBlank(msgCenter.getId())) {
            msgCenter.setId(PKGenerator.generateId());
        }
        msgCenterDao.insert(msgCenter);
    }
}
